package cn.pegasus.teamwork.pegasus.controller;

import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import cn.iyizhan.teamwork.base.util.PageObject;
import cn.pegasus.teamwork.manager.controller.BaseManagerController;
import cn.pegasus.teamwork.pegasus.entity.BussGeneralAccount;
import cn.pegasus.teamwork.pegasus.mapper.BussGeneralAccountMapper;
import cn.pegasus.teamwork.pegasus.service.BussGeneralAccountService;

@Controller
@RequestMapping("/general")
public class GeneralAccountController extends BaseManagerController<BussGeneralAccount, BussGeneralAccountMapper>{

	private static final Logger logger = LoggerFactory.getLogger(GeneralAccountController.class);
	
	@Autowired
	private BussGeneralAccountService generalAccountService;
	
	/**
	  * 查询资金总列表
	  */
	 @RequestMapping(value = "/list",method = {RequestMethod.GET})
	 public ModelAndView list(@RequestParam Map<String, Object> map){
		 ModelAndView view = new ModelAndView("finance/general-list");
		 if(map.isEmpty()){
			map.put("pageData", 10);
			map.put("curPage", 1);
		}
		 try{
			 PageObject<BussGeneralAccount> dicList = generalAccountService.PageList(map);
			 view.addObject("list", dicList);
			 view.addObject("map", map);
		 }catch(Exception e){
			 logger.error("查询评论列表异常",e.getMessage());
		 }
		 return view;
	 }
}
